home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 11
/
CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso
/
cucd
/
programming
/
oberonv4
/
source
/
system
/
amigamfm.mod
(
.txt
)
< prev
next >
Wrap
Oberon Text
|
1994-06-23
|
8KB
|
166 lines
Syntax10.Scn.Fnt
Syntax10i.Scn.Fnt
Syntax10b.Scn.Fnt
MODULE AmigaMFM; (* Marc Pilloud, 19. Apr 94 *)
IMPORT SYSTEM, e := AmigaExec;
*--------------------------------------------------------------------
* Physical drive constants
*--------------------------------------------------------------------
(* OBSOLETE -- use the TD_GETNUMTRACKS command! *)
(*#define NUMCYLS 80*) (* normal # of cylinders *)
(*#define MAXCYLS (NUMCYLS+20)*) (* max # cyls to look for during cal *)
(*#define NUMHEADS 2*)
(*#define NUMTRACKS (NUMCYLS*NUMHEADS)*)
CONST
numSecs * = 9; (* PI: 11 -> 9 *)
numUnits * = 4;
*--------------------------------------------------------------------
* Useful constants
*--------------------------------------------------------------------
(*-- sizes before mfm encoding *)
sector * = 512;
secShift * = 9; (* log TD_SECTOR *)
*--------------------------------------------------------------------
* Driver Specific Commands
*--------------------------------------------------------------------
*-- TD_NAME is a generic macro to get the name of the driver. This
*-- way if the name is ever changed you will pick up the change
*-- automatically.
*-- Normal usage would be:
*-- char internalName[] = TD_NAME;
name * = "mfm.device"; (* PI : trackdisk.device -> mfm.device *)
extCom * = MIN(INTEGER); (* 8000U for internal use only! *)
motor * = e.nonstd+0; (* control the disk's motor *)
seek * = e.nonstd+1; (* explicit seek (for testing) *)
format * = e.nonstd+2; (* format disk *)
remove * = e.nonstd+3; (* notify when disk changes *)
changeNum * = e.nonstd+4; (* number of disk changes *)
changeState * = e.nonstd+5; (* is there a disk in the drive? *)
protStatus * = e.nonstd+6; (* is the disk write protected? *)
rawRead * = e.nonstd+7; (* read raw bits from the disk *)
rawWrite * = e.nonstd+8; (* write raw bits to the disk *)
getDriveType * = e.nonstd+9; (* get the type of the disk drive *)
getNumTracks * = e.nonstd+10; (* # of tracks for this type drive *)
addChangeInt * = e.nonstd+11; (* TD_REMOVE done right *)
remChangeInt * = e.nonstd+12; (* remove softint set by ADDCHANGEINT *)
getGeometry * = e.nonstd+13; (* gets the disk geometry table *)
eject * = e.nonstd+14; (* for those drives that support it *)
lastcomm * = e.nonstd+15;
* The disk driver has an "extended command" facility. These commands
* take a superset of the normal IO Request block.
extWrite * = extCom+e.write;
extRead * = extCom+e.read;
extMotor * = extCom+motor;
extSeek * = extCom+seek;
extFormat * = extCom+format;
extUpdate * = extCom+e.update;
extClear * = extCom+e.clear;
extRawRead * = extCom+rawRead;
extRawWrite * = extCom+rawWrite;
* extended IO has a larger than normal io request block.
IOExtMFMPtr * = LONGINT; (* PI: TD -> MFM *)
IOExtMFM * = RECORD
req * : e.IOStdReq;
count * : LONGINT;
secLabel * : LONGINT;
END;
* This is the structure returned by TD_DRIVEGEOMETRY
* Note that the layout can be defined three ways:
* 1. TotalSectors
* 2. Cylinders and CylSectors
* 3. Cylinders, Heads, and TrackSectors.
* #1 is most accurate, #2 is less so, and #3 is least accurate. All
* are usable, though #2 and #3 may waste some portion of the available
* space on some drives.
DriveGeometryPtr * = LONGINT;
DriveGeometry * = RECORD
sectorSize * : LONGINT; (* in bytes *)
totalSectors * : LONGINT; (* total # of sectors on drive *)
cylinders * : LONGINT; (* number of cylinders *)
cylSectors * : LONGINT; (* number of sectors/cylinder *)
heads * : LONGINT; (* number of surfaces *)
trackSectors * : LONGINT; (* number of sectors/track *)
bufMemType * : LONGINT; (* preferred buffer memory type *)
(* (usually MEMF_PUBLIC) *)
deviceType * : SHORTINT; (* codes as defined in the SCSI-2 spec*)
flags * : SHORTINT; (* flags, including removable *)
reserved * : INTEGER;
END;
CONST
(* device types *)
directAccess * = 0;
sequentialAccess * = 1;
printer * = 2;
processor * = 3;
worm * = 4;
cdRom * = 5;
scanner * = 6;
opticalDisk * = 7;
mediumChanger * = 8;
communication * = 9;
unknown * = 31;
(* flags *)
removable * = 0;
** raw read and write can be synced with the index pulse. This flag
** in io request's IO_FLAGS field tells the driver that you want this.
indexSync * = 4;
** raw read and write can be synced with a 04489H sync pattern. This flag
** in io request's IO_FLAGS field tells the driver that you want this.
wordSync * = 5;
(* labels are TD_LABELSIZE bytes per sector *)
labelSize * = 16;
** This is a bit in the FLAGS field of OpenDevice. If it is set, then
** the driver will allow you to open all the disks that the trackdisk
** driver understands. Otherwise only 3.5" disks will succeed.
allowNon35 * = 0;
** If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice, then you don't
** know what type of disk you really got. These defines are for the
** TD_GETDRIVETYPE command. In addition, you can find out how many
** tracks are supported via the TD_GETNUMTRACKS command.
drive35 * = 1;
drive525 * = 2;
drvie35150rpm * = 3;
*--------------------------------------------------------------------
* Driver error defines
*--------------------------------------------------------------------
notSpecified * = 20; (* general catchall *)
noSecHdr * = 21; (* couldn't even find a sector *)
badSecPreamble * = 22; (* sector looked wrong *)
badSecID * = 23; (* ditto *)
badHdrSum * = 24; (* header had incorrect checksum *)
badSecSum * = 25; (* data had incorrect checksum *)
tooFewSecs * = 26; (* couldn't find enough sectors *)
badSecHdr * = 27; (* another "sector looked wrong" *)
writeProt * = 28; (* can't write to a protected disk *)
diskChanged * = 29; (* no disk in the drive *)
seekError * = 30; (* couldn't find track 0 *)
noMem * = 31; (* ran out of memory *)
badUnitNum * = 32; (* asked for a unit > NUMUNITS *)
badDriveType * = 33; (* not a drive that trackdisk groks *)
driveInUse * = 34; (* someone else allocated the drive *)
postReset * = 35; (* user hit reset; awaiting doom *)
*--------------------------------------------------------------------
* public portion of the unit structure
*--------------------------------------------------------------------
PublicUnitPtr * = LONGINT;
PublicUnit * = RECORD
unit * : e.Unit; (* base message port *)
comp01Track * : INTEGER; (* track for first precomp *)
comp10Track * : INTEGER; (* track for second precomp *)
comp11Track * : INTEGER; (* track for third precomp *)
stepDelay * : LONGINT; (* time to wait after stepping *)
settleDelay * : LONGINT; (* time to wait after seeking *)
retryCnt * : SHORTINT; (* # of times to retry *)
pubFlags * : SHORTINT; (* public flags, see below *)
currTrk * : INTEGER; (* track the heads are over... *)
(* ONLY ACCESS WHILE UNIT IS STOPPED! *)
calibrateDelay * : LONGINT; (* time to wait after stepping *)
(* during a recalibrate *)
counter * : LONGINT; (* counter for disk changes... *)
(* ONLY ACCESS WHILE UNIT IS STOPPED! *)
END;
CONST
(* flags for tdu_PubFlags *)
noClick * = 0;
END AmigaMFM.